package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.AssetsApprovalSteps;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;
import org.springframework.web.bind.annotation.RequestParam;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/AssetsApprovalStepsMapper.class */
public interface AssetsApprovalStepsMapper {
    @Delete({"delete from assets_approval_steps where steps_type = #{stepType,jdbcType=VARCHAR}"})
    int deleteByStepType(String str);

    @Insert({"insert into assets_approval_steps (steps_id, ", "steps_type, pass_next_id, ", "rejected_next_id, role_id, ", "explanation, remarks) ", "values", "  (#{stepsId}, #{stepsType}, #{passNextId},#{rejectedNextId}, #{roleId},#{explanation}, #{remarks})"})
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int add(AssetsApprovalSteps assetsApprovalSteps);

    @Select({"select * from assets_approval_steps", "where id = #{id,jdbcType=INTEGER}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "steps_id", property = "stepsId", jdbcType = JdbcType.INTEGER), @Result(column = "steps_type", property = "stepsType", jdbcType = JdbcType.VARCHAR), @Result(column = "pass_next_id", property = "passNextId", jdbcType = JdbcType.INTEGER), @Result(column = "rejected_next_id", property = "rejectedNextId", jdbcType = JdbcType.INTEGER), @Result(column = "role_id", property = "roleId", jdbcType = JdbcType.INTEGER), @Result(column = "explanation", property = "explanation", jdbcType = JdbcType.VARCHAR), @Result(column = "remarks", property = "remarks", jdbcType = JdbcType.VARCHAR)})
    AssetsApprovalSteps findById(Integer num);

    @Select({"select * from assets_approval_steps"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "steps_id", property = "stepsId", jdbcType = JdbcType.INTEGER), @Result(column = "steps_type", property = "stepsType", jdbcType = JdbcType.VARCHAR), @Result(column = "pass_next_id", property = "passNextId", jdbcType = JdbcType.INTEGER), @Result(column = "rejected_next_id", property = "rejectedNextId", jdbcType = JdbcType.INTEGER), @Result(column = "role_id", property = "roleId", jdbcType = JdbcType.INTEGER), @Result(column = "explanation", property = "explanation", jdbcType = JdbcType.VARCHAR), @Result(column = "remarks", property = "remarks", jdbcType = JdbcType.VARCHAR)})
    List<AssetsApprovalSteps> findAll();

    @Update({"update assets_approval_steps set steps_id = #{stepsId,jdbcType=INTEGER},", "steps_type = #{stepsType,jdbcType=VARCHAR},", "pass_next_id = #{passNextId,jdbcType=INTEGER},", "rejected_next_id = #{rejectedNextId,jdbcType=INTEGER},", "role_id = #{roleId,jdbcType=INTEGER},", "explanation = #{explanation,jdbcType=VARCHAR},", "remarks = #{remarks,jdbcType=VARCHAR}", "where id = #{id,jdbcType=INTEGER}"})
    int updateById(AssetsApprovalSteps assetsApprovalSteps);

    @Select({" SELECT t1.*,t2.role_name  FROM `assets_approval_steps` t1 LEFT JOIN role t2 ON t1.role_id = t2.id WHERE t1.steps_type=#{stepsType}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "steps_id", property = "stepsId", jdbcType = JdbcType.INTEGER), @Result(column = "steps_type", property = "stepsType", jdbcType = JdbcType.VARCHAR), @Result(column = "pass_next_id", property = "passNextId", jdbcType = JdbcType.INTEGER), @Result(column = "rejected_next_id", property = "rejectedNextId", jdbcType = JdbcType.INTEGER), @Result(column = "role_id", property = "roleId", jdbcType = JdbcType.INTEGER), @Result(column = "explanation", property = "explanation", jdbcType = JdbcType.VARCHAR), @Result(column = "remarks", property = "remarks", jdbcType = JdbcType.VARCHAR), @Result(column = "role_name", property = "roleName", jdbcType = JdbcType.VARCHAR)})
    List<AssetsApprovalSteps> findByCondition(@RequestParam String str);
}